<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax</title>
    <style>
        .conver{
            position: absolute;
            /*z-index: 200;*/
            width: 100%;
            height: 100%;
            background: orangered;
            display: none;
            opacity: .45;
            left: 0;
            top: 0;
        }
    </style>
    <script src="../../jquery-js/jquery.js"></script>
    <script>
        $(function () {
            $('.get').click(function () {
                $.get({
                    url: 'http://47.107.100.125:8080/api/home/getAgreement',
                    async: false,
                    success: function (data) {
                        console.log(data);
                    },
                    error: function () {
                        console.log('请求失败');
                    }
                });
            });

            $('.post').click(function () {
                $.post({
                    url: 'http://47.107.100.125:8080/api/home/getAgreement',
                    async: true,
                    success: function (data) {
                        console.log(data);
                    },
                    error: function () {
                        console.log('请求失败');
                    }
                });
            });

            $('.ajax').click(function () {
                $.ajax({
                    url: 'http://47.107.100.125:8080/api/home/getAgreement',
                    type: 'post',
                    // dataType: 'jsonp',   //跨域
                    // jsonp: "callback",  //默认值为callback
                    async: true,
                    success: function (data) {
                        console.log(data);
                        console.log('请求成功');
                    },
                    error: function () {
                        console.log('请求失败');
                    },
                    complete:function () {
                        console.log('请求完成');
                    }
                });
            });

            $(document).ajaxStart(function () {
               $('.conver').show(3000);
            });

            $(document).ajaxComplete(function () {
                $('.conver').hide(3000);
            });
        });
    </script>

</head>
<body>
<input class="get" type="button" value="Get请求">
<input class="post" type="button" value="Post请求">
<input class="ajax" type="button" value="Ajax">
<div class="conver"></div>
</body>
</html>